{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[37.2, 37.599999999999994, 36.8]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def xh_test(n):\n",
    "    x = np.array([[1.2, 1.5, 1.8],\n",
    "           [1.3, 1.4, 1.9],\n",
    "           [1.1, 1.6, 1.7]])\n",
    "    y = np.array([5, 10, 9]).T\n",
    "    for j in range(n):\n",
    "        c =[sum((x*y)[i]) for i in range(3)]\n",
    "    return c    \n",
    "xh_test(1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([37.2, 37.6, 36.8])"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def dot_test(n):\n",
    "    x = np.array([[1.2, 1.5, 1.8],\n",
    "           [1.3, 1.4, 1.9],\n",
    "           [1.1, 1.6, 1.7]])\n",
    "    y = np.array([5, 10, 9]).T   \n",
    "    for j in range(n):\n",
    "        c = np.dot(x,y)\n",
    "    return c  \n",
    "dot_test(1000)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 28 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[37.2, 37.599999999999994, 36.8]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time xh_test(1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 7 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([37.2, 37.6, 36.8])"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time dot_test(1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
